package com.jweb.framework.mvc.bean;

import java.util.Map;

import com.jweb.framework.util.FormatUtil;

/**
 * 封装请求参数
 *
 * @author huangyong
 * @since 2.2
 */
public class Params {

	private final Map<String, Object> fieldMap;

	public Params(Map<String, Object> fieldMap) {
		this.fieldMap = fieldMap;
	}

	public Map<String, Object> getFieldMap() {
		return fieldMap;
	}

	public String getString(String name) {
		return FormatUtil.toString(get(name));
	}

	public double getDouble(String name) {
		return FormatUtil.toDouble(get(name));
	}

	public long getLong(String name) {
		return FormatUtil.toLong(get(name));
	}

	public int getInt(String name) {
		return FormatUtil.toInt(get(name));
	}

	private Object get(String name) {
		return fieldMap.get(name);
	}
}
